<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/1
 * Time: 16:04
 */

namespace vendor;

use vendor\user\user;
use vendor\user\common1;
use vendor\user\vip1;
use vendor\user\vip2;

require 'user\user.php';
require 'user\common1.php';
require 'user\vip1.php';
require 'user\vip2.php';

//$user1 = new user();
//$user1->register();
//echo '<br />';
//$user1->login();
//echo '<br />';
//$user1->update_pwd();

class manager
{
    public $arr=[];
    //开启网站
    public function allnumber(){
        $this->arr[]=$this->users(0);
        $this->arr[]=$this->users(1);
        $this->arr[]=$this->users(2);
        echo '<br />数组的个数为：'.count($this->arr).'<br />';
    }
    //关闭网站
    public function close(){
        echo '<br />关闭网站。';
    }
    public function users($allusers){
        $user = null;
        switch ($allusers){
            case 0;
            $user = new common1;
                break;
            case 1;
            $user = new vip1;
                break;
            case 2;
            $user = new vip2;
                break;
        }
        $this->show_online_number();
        $user->user();
        return $user;
    }
//    //创建一个普通用户
//    public function common_user1(){
//        $common1 = new common1();
//        $this->show_online_number();
//        $common1->user();
//        return $common1;
//    }
//    //创建一个VIP1用户
//    public function vip_user1(){
//        $vip1 = new vip1();
//        $this->show_online_number();
//        $vip1->user();
//        return $vip1;
//    }
//    //创建一个VIP2用户
//    public function vip_user2(){
//        $vip2 = new vip2();
//        $this->show_online_number();
//        $vip2->user();
//        return $vip2;
//    }
    //获取在线人数
    public function show_online_number(){
        echo '<br />在线人数为：'.user::get_online_number();
    }
    public function destruct(){
        echo '删除manager对象。';
    }
}
$manager = new manager();
$manager->allnumber();
$manager->close();
